<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>i2c: C:/Users/Jon/Downloads/OOP/db-control/dbOrganization.php Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">i2c
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">C:/Users/Jon/Downloads/OOP/db-control/dbOrganization.php</div>  </div>
</div>
<div class="contents">
<a href="db_organization_8php.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 &lt;?php
<a name="l00002"></a>00002 
<a name="l00025"></a><a class="code" href="classdb_organization.html">00025</a> <span class="keyword">class </span><a class="code" href="classdb_organization.html">dbOrganization</a> {
<a name="l00026"></a>00026 
<a name="l00027"></a><a class="code" href="classdb_organization.html#aea6c4d653e217f31256ded5783ed58f4">00027</a>    <span class="keyword">static</span> <span class="keyword">function</span> <a class="code" href="classdb_organization.html#aea6c4d653e217f31256ded5783ed58f4">createTable</a>() {
<a name="l00028"></a>00028       <span class="comment">//Create table organization</span>
<a name="l00029"></a>00029       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = <span class="stringliteral">&quot;</span>
<a name="l00030"></a>00030 <span class="stringliteral">            create table organization(</span>
<a name="l00031"></a>00031 <span class="stringliteral">                organizationID          int             NOT NULL AUTO_INCREMENT,</span>
<a name="l00032"></a>00032 <span class="stringliteral">                organizationName        varchar(45)     NOT NULL,</span>
<a name="l00033"></a>00033 <span class="stringliteral">                description             text            NULL,</span>
<a name="l00034"></a>00034 <span class="stringliteral">                address                 varchar(45)     NOT NULL,</span>
<a name="l00035"></a>00035 <span class="stringliteral">                address1                varchar(45)     NULL,</span>
<a name="l00036"></a>00036 <span class="stringliteral">                city                    varchar(25)     NOT NULL,</span>
<a name="l00037"></a>00037 <span class="stringliteral">                stateName               varchar(2)      NOT NULL,</span>
<a name="l00038"></a>00038 <span class="stringliteral">                zip                     varchar(10)     NOT NULL,</span>
<a name="l00039"></a>00039 <span class="stringliteral">                constraint PK_Organization PRIMARY KEY(organizationID)</span>
<a name="l00040"></a>00040 <span class="stringliteral">                );</span>
<a name="l00041"></a>00041 <span class="stringliteral">        &quot;</span>;
<a name="l00042"></a>00042       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00043"></a>00043       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00044"></a>00044       mysql_close();
<a name="l00045"></a>00045       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00046"></a>00046          echo mysql_error();
<a name="l00047"></a>00047          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00048"></a>00048       }
<a name="l00049"></a>00049       <span class="comment">//mysql_close();</span>
<a name="l00050"></a>00050       <span class="comment">//Previous query was successful</span>
<a name="l00051"></a>00051       <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00052"></a>00052    }
<a name="l00053"></a>00053 
<a name="l00060"></a><a class="code" href="classdb_organization.html#adc4fa016c55f687b7432b42c85541d4c">00060</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#adc4fa016c55f687b7432b42c85541d4c">getAllOrganizations</a>() {
<a name="l00061"></a>00061       $search = <a class="code" href="logout_8php.html#aa3f93905a0a94ad29ddd47d9e5638098">$_SESSION</a>[<span class="stringliteral">&#39;search&#39;</span>];
<a name="l00062"></a>00062       $sort = <a class="code" href="logout_8php.html#aa3f93905a0a94ad29ddd47d9e5638098">$_SESSION</a>[<span class="stringliteral">&#39;sortBy&#39;</span>];
<a name="l00063"></a>00063 
<a name="l00064"></a>00064       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = <a class="code" href="classdb_organization.html#aa2d64a18b3dd1239a86dbfa299f579f4">dbOrganization::buildQuery</a>($search, $sort);
<a name="l00065"></a>00065       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00066"></a>00066       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00067"></a>00067       mysql_close();
<a name="l00068"></a>00068       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00069"></a>00069          echo mysql_error();
<a name="l00070"></a>00070          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00071"></a>00071       }
<a name="l00072"></a>00072 
<a name="l00073"></a>00073       <span class="comment">//Query was successful.</span>
<a name="l00074"></a>00074       <span class="keywordflow">return</span> <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>;
<a name="l00075"></a>00075    }
<a name="l00076"></a>00076 
<a name="l00077"></a><a class="code" href="classdb_organization.html#aa2d64a18b3dd1239a86dbfa299f579f4">00077</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#aa2d64a18b3dd1239a86dbfa299f579f4">buildQuery</a>($search, $sort) {
<a name="l00078"></a>00078 
<a name="l00079"></a>00079       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = <span class="stringliteral">&quot;SELECT * FROM organization WHERE organizationName LIKE &#39;%$search%&#39; OR city LIKE &#39;%$search%&#39; OR description LIKE &#39;%$search%&#39; &quot;</span>;
<a name="l00080"></a>00080 
<a name="l00081"></a>00081       <span class="comment">//need to order by $sort</span>
<a name="l00082"></a>00082       <span class="keywordflow">switch</span> ($sort) {
<a name="l00083"></a>00083          <span class="keywordflow">case</span> <span class="stringliteral">&#39;name_asc&#39;</span>:
<a name="l00084"></a>00084             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY organizationName ASC&quot;</span>;
<a name="l00085"></a>00085             <span class="keywordflow">break</span>;
<a name="l00086"></a>00086          <span class="keywordflow">case</span> <span class="stringliteral">&#39;name_desc&#39;</span>:
<a name="l00087"></a>00087             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY organizationName DESC&quot;</span>;
<a name="l00088"></a>00088             <span class="keywordflow">break</span>;
<a name="l00089"></a>00089          <span class="keywordflow">case</span> <span class="stringliteral">&#39;city_asc&#39;</span>:
<a name="l00090"></a>00090             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY city ASC&quot;</span>;
<a name="l00091"></a>00091             <span class="keywordflow">break</span>;
<a name="l00092"></a>00092          <span class="keywordflow">case</span> <span class="stringliteral">&#39;city_desc&#39;</span>:
<a name="l00093"></a>00093             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY city DESC&quot;</span>;
<a name="l00094"></a>00094             <span class="keywordflow">break</span>;
<a name="l00095"></a>00095          <span class="keywordflow">case</span> <span class="stringliteral">&#39;add1_desc&#39;</span>:
<a name="l00096"></a>00096             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY address DESC&quot;</span>;
<a name="l00097"></a>00097             <span class="keywordflow">break</span>;
<a name="l00098"></a>00098          <span class="keywordflow">case</span> <span class="stringliteral">&#39;add1_asc&#39;</span>:
<a name="l00099"></a>00099             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY address1 ASC&quot;</span>;
<a name="l00100"></a>00100             <span class="keywordflow">break</span>;
<a name="l00101"></a>00101          <span class="keywordflow">case</span> <span class="stringliteral">&#39;add2_desc&#39;</span>:
<a name="l00102"></a>00102             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY address1 DESC&quot;</span>;
<a name="l00103"></a>00103             <span class="keywordflow">break</span>;
<a name="l00104"></a>00104          <span class="keywordflow">case</span> <span class="stringliteral">&#39;add2_asc&#39;</span>:
<a name="l00105"></a>00105             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY address1 ASC&quot;</span>;
<a name="l00106"></a>00106             <span class="keywordflow">break</span>;
<a name="l00107"></a>00107          <span class="keywordflow">case</span> <span class="stringliteral">&#39;zip_asc&#39;</span>:
<a name="l00108"></a>00108             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY zip ASC&quot;</span>;
<a name="l00109"></a>00109             <span class="keywordflow">break</span>;
<a name="l00110"></a>00110          <span class="keywordflow">case</span> <span class="stringliteral">&#39;zip_desc&#39;</span>:
<a name="l00111"></a>00111             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY zip DESC&quot;</span>;
<a name="l00112"></a>00112             <span class="keywordflow">break</span>;
<a name="l00113"></a>00113          <span class="keywordflow">case</span> <span class="stringliteral">&#39;desc_asc&#39;</span>:
<a name="l00114"></a>00114             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY description ASC&quot;</span>;
<a name="l00115"></a>00115             <span class="keywordflow">break</span>;
<a name="l00116"></a>00116          <span class="keywordflow">case</span> <span class="stringliteral">&#39;desc_desc&#39;</span>:
<a name="l00117"></a>00117             <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> .= <span class="stringliteral">&quot;ORDER BY description DESC&quot;</span>;
<a name="l00118"></a>00118             <span class="keywordflow">break</span>;
<a name="l00119"></a>00119       }
<a name="l00120"></a>00120 
<a name="l00121"></a>00121       <span class="keywordflow">return</span> <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>;
<a name="l00122"></a>00122    }
<a name="l00123"></a>00123 
<a name="l00128"></a><a class="code" href="classdb_organization.html#ae08ebacf19877370e18d4ddc9d70cf95">00128</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#ae08ebacf19877370e18d4ddc9d70cf95">getOrganizationID</a>($o) {
<a name="l00129"></a>00129       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<span class="stringliteral">&quot;SELECT organizationID FROM organization WHERE</span>
<a name="l00130"></a>00130 <span class="stringliteral">            organizationID=&#39;$o&#39;&quot;</span>);
<a name="l00131"></a>00131       $row = mysql_fetch_row(<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>);
<a name="l00132"></a>00132       <span class="keywordflow">return</span> $row[<span class="charliteral">&#39;0&#39;</span>];
<a name="l00133"></a>00133    }
<a name="l00134"></a>00134 
<a name="l00135"></a><a class="code" href="classdb_organization.html#acbf9231ed41368b197a224e0a3c508b9">00135</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#acbf9231ed41368b197a224e0a3c508b9">getOrganizationName</a>($o) {
<a name="l00136"></a>00136       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = <span class="stringliteral">&quot;SELECT organizationName FROM organization</span>
<a name="l00137"></a>00137 <span class="stringliteral">        WHERE organizationID=&#39;$o&#39;&quot;</span>;
<a name="l00138"></a>00138       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00139"></a>00139       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00140"></a>00140       mysql_close();
<a name="l00141"></a>00141       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00142"></a>00142          echo mysql_error();
<a name="l00143"></a>00143          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00144"></a>00144       }
<a name="l00145"></a>00145       <span class="comment">//Query was successful.</span>
<a name="l00146"></a>00146       <span class="keywordflow">return</span> <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>;
<a name="l00147"></a>00147    }
<a name="l00148"></a>00148 
<a name="l00149"></a><a class="code" href="classdb_organization.html#a97a2ae042a57fd9b756f8f974fa1a9e2">00149</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a97a2ae042a57fd9b756f8f974fa1a9e2">deleteFromOrganization</a>($id) {
<a name="l00150"></a>00150 
<a name="l00151"></a>00151       <span class="comment">//Compose the DELETE FROM query string.</span>
<a name="l00152"></a>00152       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = sprintf(<span class="stringliteral">&quot;DELETE FROM organization WHERE organizationID=%d&quot;</span>, $id);
<a name="l00153"></a>00153       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00154"></a>00154       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00155"></a>00155 
<a name="l00156"></a>00156       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00157"></a>00157          echo mysql_error();
<a name="l00158"></a>00158          mysql_close();
<a name="l00159"></a>00159          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00160"></a>00160       }
<a name="l00161"></a>00161       <span class="comment">//Query was successful.</span>
<a name="l00162"></a>00162       <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00163"></a>00163    }
<a name="l00164"></a>00164 
<a name="l00165"></a><a class="code" href="classdb_organization.html#a291bbe2b93ddff943c9bb1dc457546e4">00165</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a291bbe2b93ddff943c9bb1dc457546e4">getDescription</a>($o) {
<a name="l00166"></a>00166       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = <span class="stringliteral">&quot;SELECT description FROM organization</span>
<a name="l00167"></a>00167 <span class="stringliteral">        WHERE organizationID=&#39;$c&#39;&quot;</span>;
<a name="l00168"></a>00168       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00169"></a>00169       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00170"></a>00170       mysql_close();
<a name="l00171"></a>00171       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00172"></a>00172          echo mysql_error();
<a name="l00173"></a>00173          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00174"></a>00174       }
<a name="l00175"></a>00175       <span class="comment">//Query was successful.</span>
<a name="l00176"></a>00176       <span class="keywordflow">return</span> <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>;
<a name="l00177"></a>00177    }
<a name="l00178"></a>00178 
<a name="l00179"></a><a class="code" href="classdb_organization.html#a9cd17644bf53f6f1b8d72308a7ec6bc5">00179</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a9cd17644bf53f6f1b8d72308a7ec6bc5">getAddress</a>($o) {
<a name="l00180"></a>00180       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = <span class="stringliteral">&quot;SELECT address FROM organization</span>
<a name="l00181"></a>00181 <span class="stringliteral">        WHERE organizationID=&#39;$c&#39;&quot;</span>;
<a name="l00182"></a>00182       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00183"></a>00183       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00184"></a>00184       mysql_close();
<a name="l00185"></a>00185       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00186"></a>00186          echo mysql_error();
<a name="l00187"></a>00187          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00188"></a>00188       }
<a name="l00189"></a>00189       <span class="comment">//Query was successful.</span>
<a name="l00190"></a>00190       <span class="keywordflow">return</span> <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>;
<a name="l00191"></a>00191    }
<a name="l00192"></a>00192 
<a name="l00193"></a><a class="code" href="classdb_organization.html#ac7d2df1419267484aa411f5f1464d1a1">00193</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#ac7d2df1419267484aa411f5f1464d1a1">getAddress1</a>($o) {
<a name="l00194"></a>00194       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = <span class="stringliteral">&quot;SELECT address1 FROM organization</span>
<a name="l00195"></a>00195 <span class="stringliteral">        WHERE organizationID=&#39;$c&#39;&quot;</span>;
<a name="l00196"></a>00196       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00197"></a>00197       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00198"></a>00198       mysql_close();
<a name="l00199"></a>00199       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00200"></a>00200          echo mysql_error();
<a name="l00201"></a>00201          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00202"></a>00202       }
<a name="l00203"></a>00203       <span class="comment">//Query was successful.</span>
<a name="l00204"></a>00204       <span class="keywordflow">return</span> <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>;
<a name="l00205"></a>00205    }
<a name="l00206"></a>00206 
<a name="l00207"></a><a class="code" href="classdb_organization.html#a263dc404576137658db70379a44f686d">00207</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a263dc404576137658db70379a44f686d">getCity</a>($o) {
<a name="l00208"></a>00208       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = <span class="stringliteral">&quot;SELECT city FROM organization</span>
<a name="l00209"></a>00209 <span class="stringliteral">        WHERE organizationID=&#39;$c&#39;&quot;</span>;
<a name="l00210"></a>00210       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00211"></a>00211       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00212"></a>00212       mysql_close();
<a name="l00213"></a>00213       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00214"></a>00214          echo mysql_error();
<a name="l00215"></a>00215          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00216"></a>00216       }
<a name="l00217"></a>00217       <span class="comment">//Query was successful.</span>
<a name="l00218"></a>00218       <span class="keywordflow">return</span> <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>;
<a name="l00219"></a>00219    }
<a name="l00220"></a>00220 
<a name="l00221"></a><a class="code" href="classdb_organization.html#a1dd55358790256c4504031c864f99a64">00221</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a1dd55358790256c4504031c864f99a64">getStateName</a>($o) {
<a name="l00222"></a>00222       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = <span class="stringliteral">&quot;SELECT stateName FROM organization</span>
<a name="l00223"></a>00223 <span class="stringliteral">        WHERE organizationID=&#39;$c&#39;&quot;</span>;
<a name="l00224"></a>00224       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00225"></a>00225       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00226"></a>00226       mysql_close();
<a name="l00227"></a>00227       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00228"></a>00228          echo mysql_error();
<a name="l00229"></a>00229          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00230"></a>00230       }
<a name="l00231"></a>00231       <span class="comment">//Query was successful.</span>
<a name="l00232"></a>00232       <span class="keywordflow">return</span> <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>;
<a name="l00233"></a>00233    }
<a name="l00234"></a>00234 
<a name="l00235"></a><a class="code" href="classdb_organization.html#ad3add86b9744236d8a4248b89bfb59b4">00235</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#ad3add86b9744236d8a4248b89bfb59b4">getZip</a>($o) {
<a name="l00236"></a>00236       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = <span class="stringliteral">&quot;SELECT zip FROM organization</span>
<a name="l00237"></a>00237 <span class="stringliteral">        WHERE organizationID=&#39;$c&#39;&quot;</span>;
<a name="l00238"></a>00238       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00239"></a>00239       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00240"></a>00240       mysql_close();
<a name="l00241"></a>00241       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00242"></a>00242          echo mysql_error();
<a name="l00243"></a>00243          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00244"></a>00244       }
<a name="l00245"></a>00245       <span class="comment">//Query was successful.</span>
<a name="l00246"></a>00246       <span class="keywordflow">return</span> <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>;
<a name="l00247"></a>00247    }
<a name="l00248"></a>00248 
<a name="l00255"></a><a class="code" href="classdb_organization.html#a086b4a3ee747007a1095ed8549247203">00255</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a086b4a3ee747007a1095ed8549247203">updateOrganization</a>($id, $o) {
<a name="l00256"></a>00256       <span class="keywordflow">if</span> (!($o instanceof <a class="code" href="class_organization.html">Organization</a>)) {
<a name="l00257"></a>00257          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00258"></a>00258       }
<a name="l00259"></a>00259       $organizationID = $id;
<a name="l00260"></a>00260       $organizationName = $o-&gt;getOrganizationName();
<a name="l00261"></a>00261       <a class="code" href="old_2internship-request_8php.html#a87b032cba06009e3467abf1c8018d960">$description</a> = $o-&gt;getDescription();
<a name="l00262"></a>00262       $address = $o-&gt;getAddress();
<a name="l00263"></a>00263       <a class="code" href="internship-request_8php.html#a653579f1800dead9ae026af236859831">$address1</a> = $o-&gt;getAddress1();
<a name="l00264"></a>00264       <a class="code" href="old_2internship-request_8php.html#a5b9ddd3e3a69d8901270064346bdef49">$city</a> = $o-&gt;getCity();
<a name="l00265"></a>00265       $stateName = $o-&gt;getState();
<a name="l00266"></a>00266       <a class="code" href="old_2internship-request_8php.html#aa91be3142812d8cd4221c6f54555079b">$zip</a> = $o-&gt;getZip();
<a name="l00267"></a>00267 
<a name="l00268"></a>00268       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00269"></a>00269 
<a name="l00270"></a>00270       <span class="keywordflow">if</span> ($organizationID == <span class="stringliteral">&#39;&#39;</span>) {
<a name="l00271"></a>00271          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00272"></a>00272       } <span class="keywordflow">else</span> {
<a name="l00273"></a>00273          <span class="keywordflow">if</span> ($organizationName != <span class="stringliteral">&#39;&#39;</span>) {
<a name="l00274"></a>00274             <span class="keywordflow">if</span> (!mysql_query(<span class="stringliteral">&quot;UPDATE organization SET organizationName=</span>
<a name="l00275"></a>00275 <span class="stringliteral">                        &#39;$organizationName&#39;</span>
<a name="l00276"></a>00276 <span class="stringliteral">                        WHERE organizationID=$organizationID&quot;</span>))
<a name="l00277"></a>00277                die(<span class="stringliteral">&quot;1Could not update organization with ID =</span>
<a name="l00278"></a>00278 <span class="stringliteral">                        $organizationID&quot;</span>);
<a name="l00279"></a>00279          }
<a name="l00280"></a>00280          <span class="keywordflow">if</span> (!mysql_query(<span class="stringliteral">&quot;UPDATE organization SET description=</span>
<a name="l00281"></a>00281 <span class="stringliteral">                        &#39;$description&#39;</span>
<a name="l00282"></a>00282 <span class="stringliteral">                        WHERE organizationID=$organizationID&quot;</span>))
<a name="l00283"></a>00283             die(<span class="stringliteral">&quot;2Could not update organization with ID =</span>
<a name="l00284"></a>00284 <span class="stringliteral">                        $organizationID&quot;</span>);
<a name="l00285"></a>00285 
<a name="l00286"></a>00286          <span class="keywordflow">if</span> (!mysql_query(<span class="stringliteral">&quot;UPDATE organization SET address=&#39;$address&#39;</span>
<a name="l00287"></a>00287 <span class="stringliteral">                        WHERE organizationID=$organizationID&quot;</span>))
<a name="l00288"></a>00288             die(<span class="stringliteral">&quot;3could not update organization with ID =</span>
<a name="l00289"></a>00289 <span class="stringliteral">                        $organizationID&quot;</span>);
<a name="l00290"></a>00290 
<a name="l00291"></a>00291 
<a name="l00292"></a>00292          <span class="keywordflow">if</span> (!mysql_query(<span class="stringliteral">&quot;UPDATE organization SET address1=&#39;$address1&#39;</span>
<a name="l00293"></a>00293 <span class="stringliteral">                        WHERE organizationID=$organizationID&quot;</span>))
<a name="l00294"></a>00294             die(<span class="stringliteral">&quot;4could not update organization with ID =</span>
<a name="l00295"></a>00295 <span class="stringliteral">                        $organizationID&quot;</span>);
<a name="l00296"></a>00296 
<a name="l00297"></a>00297          <span class="keywordflow">if</span> (<a class="code" href="old_2internship-request_8php.html#a5b9ddd3e3a69d8901270064346bdef49">$city</a> != <span class="stringliteral">&#39;&#39;</span>) {
<a name="l00298"></a>00298             <span class="keywordflow">if</span> (!mysql_query(<span class="stringliteral">&quot;UPDATE organization SET city=&#39;$city&#39; WHERE</span>
<a name="l00299"></a>00299 <span class="stringliteral">                        organizationID=$organizationID&quot;</span>))
<a name="l00300"></a>00300                die(<span class="stringliteral">&quot;5could not update organization with ID =</span>
<a name="l00301"></a>00301 <span class="stringliteral">                        $organizationID&quot;</span>);
<a name="l00302"></a>00302          }
<a name="l00303"></a>00303          <span class="keywordflow">if</span> ($stateName != <span class="stringliteral">&#39;&#39;</span>) {
<a name="l00304"></a>00304             <span class="keywordflow">if</span> (!mysql_query(<span class="stringliteral">&quot;UPDATE organization SET stateName=&#39;$stateName&#39;</span>
<a name="l00305"></a>00305 <span class="stringliteral">                        WHERE</span>
<a name="l00306"></a>00306 <span class="stringliteral">                        organizationID=$organizationID&quot;</span>))
<a name="l00307"></a>00307                die(<span class="stringliteral">&quot;6could not update organization with ID =</span>
<a name="l00308"></a>00308 <span class="stringliteral">                        $organizationID&quot;</span>);
<a name="l00309"></a>00309          }
<a name="l00310"></a>00310          <span class="keywordflow">if</span> (<a class="code" href="old_2internship-request_8php.html#aa91be3142812d8cd4221c6f54555079b">$zip</a> != <span class="stringliteral">&#39;&#39;</span>) {
<a name="l00311"></a>00311             <span class="keywordflow">if</span> (!mysql_query(<span class="stringliteral">&quot;UPDATE organization SET zip=&#39;$zip&#39; WHERE</span>
<a name="l00312"></a>00312 <span class="stringliteral">                        organizationID=$organizationID&quot;</span>))
<a name="l00313"></a>00313                die(<span class="stringliteral">&quot;7could not update organization with ID =</span>
<a name="l00314"></a>00314 <span class="stringliteral">                        $organizationID&quot;</span>);
<a name="l00315"></a>00315          }
<a name="l00316"></a>00316          mysql_close();
<a name="l00317"></a>00317          <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00318"></a>00318       }
<a name="l00319"></a>00319    }
<a name="l00320"></a>00320 
<a name="l00321"></a><a class="code" href="classdb_organization.html#a24bbd5f3b20fee4fd811b71c9e634f63">00321</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a24bbd5f3b20fee4fd811b71c9e634f63">getCities</a>() {
<a name="l00322"></a>00322       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00323"></a>00323       <span class="keywordflow">return</span> mysql_query(<span class="stringliteral">&quot;SELECT DISTINCT city FROM organization&quot;</span>);
<a name="l00324"></a>00324    }
<a name="l00325"></a>00325 
<a name="l00335"></a><a class="code" href="classdb_organization.html#a3d350adf56d7b3c7912f6d3d361ddc11">00335</a>    <span class="keyword">static</span> <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a3d350adf56d7b3c7912f6d3d361ddc11">addOrganization</a>($o, &amp;$id = null) {
<a name="l00336"></a>00336       <span class="keywordflow">if</span> (!$o instanceof <a class="code" href="class_organization.html">Organization</a>) {
<a name="l00337"></a>00337          echo (<span class="stringliteral">&quot;Invalid argument addOrganization() function&lt;br /&gt;&quot;</span>);
<a name="l00338"></a>00338          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00339"></a>00339       }
<a name="l00340"></a>00340 
<a name="l00341"></a>00341       <span class="comment">//Compose the INSERT INTO query string. Primary key value is missing.</span>
<a name="l00342"></a>00342       <span class="comment">//Database server automatically generates a unique ID for the primary</span>
<a name="l00343"></a>00343       <span class="comment">//key.</span>
<a name="l00344"></a>00344       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = sprintf(<span class="stringliteral">&quot;INSERT INTO organization VALUES (null,&#39;%s&#39;, &#39;%s&#39;, </span>
<a name="l00345"></a>00345 <span class="stringliteral">            &#39;%s&#39;, &#39;%s&#39;, &#39;%s&#39;, &#39;%s&#39;, &#39;%s&#39;)&quot;</span>, $o-&gt;getOrganizationName(), $o-&gt;getDescription(), $o-&gt;getAddress(), $o-&gt;getAddress1(), $o-&gt;getCity(), $o-&gt;getState(), $o-&gt;getZip()
<a name="l00346"></a>00346       );
<a name="l00347"></a>00347       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00348"></a>00348       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00349"></a>00349       <span class="comment">//printf(&quot;-&gt;Organization added has id %d\n&lt;br /&gt;&quot;, mysql_insert_id());</span>
<a name="l00350"></a>00350       $id = mysql_insert_id();
<a name="l00351"></a>00351       mysql_close();
<a name="l00352"></a>00352       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00353"></a>00353          echo mysql_error();
<a name="l00354"></a>00354          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00355"></a>00355       }
<a name="l00356"></a>00356       <span class="comment">//Query was successful.</span>
<a name="l00357"></a>00357       <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00358"></a>00358    }
<a name="l00359"></a>00359 
<a name="l00360"></a><a class="code" href="classdb_organization.html#aab7a964c22fbeb67f39f31210c53800d">00360</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#aab7a964c22fbeb67f39f31210c53800d">getOrgID</a>($o) {
<a name="l00361"></a>00361       <span class="keywordflow">if</span> (!($o instanceof <a class="code" href="class_organization.html">Organization</a>)) {
<a name="l00362"></a>00362          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00363"></a>00363       }
<a name="l00364"></a>00364       $organizationName = $o-&gt;getOrganizationName();
<a name="l00365"></a>00365       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00366"></a>00366       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<span class="stringliteral">&quot;SELECT organizationID FROM organization WHERE</span>
<a name="l00367"></a>00367 <span class="stringliteral">                organizationName=&#39;$organizationName&#39;&quot;</span>);
<a name="l00368"></a>00368       mysql_close();
<a name="l00369"></a>00369       $row = mysql_fetch_assoc(<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>);
<a name="l00370"></a>00370       <span class="keywordflow">return</span> $row[<span class="stringliteral">&#39;organizationID&#39;</span>];
<a name="l00371"></a>00371    }
<a name="l00372"></a>00372 
<a name="l00373"></a><a class="code" href="classdb_organization.html#aeb03eb9ec220070fb03079fb0b457775">00373</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#aeb03eb9ec220070fb03079fb0b457775">getOrganizationByName</a>($organizationName) {
<a name="l00374"></a>00374       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00375"></a>00375       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<span class="stringliteral">&quot;SELECT organizationID FROM organization WHERE</span>
<a name="l00376"></a>00376 <span class="stringliteral">                organizationName=&#39;$organizationName&#39;&quot;</span>);
<a name="l00377"></a>00377       mysql_close();
<a name="l00378"></a>00378       $row = mysql_fetch_assoc(<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>);
<a name="l00379"></a>00379       <span class="keywordflow">return</span> $row;
<a name="l00380"></a>00380    }
<a name="l00381"></a>00381 
<a name="l00382"></a><a class="code" href="classdb_organization.html#aa493dade25b4eeb870085d202226f45c">00382</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#aa493dade25b4eeb870085d202226f45c">displayOrg</a>($row) {
<a name="l00383"></a>00383       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00384"></a>00384       echo (<span class="stringliteral">&quot;Name: $row [&#39;organizationName&#39;]&lt;br /&gt;&quot;</span>);
<a name="l00385"></a>00385       mysql_close();
<a name="l00386"></a>00386    }
<a name="l00387"></a>00387 
<a name="l00393"></a><a class="code" href="classdb_organization.html#a61a8d732df4c84e8584454b819aa7131">00393</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a61a8d732df4c84e8584454b819aa7131">checkIfExists</a>($o) {
<a name="l00394"></a>00394       <span class="keywordflow">if</span> (!($o instanceof <a class="code" href="class_organization.html">Organization</a>)) {
<a name="l00395"></a>00395          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00396"></a>00396       }
<a name="l00397"></a>00397       $organizationName = $o-&gt;getOrganizationName();
<a name="l00398"></a>00398       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00399"></a>00399       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<span class="stringliteral">&quot;SELECT * FROM organization WHERE</span>
<a name="l00400"></a>00400 <span class="stringliteral">                organizationName=&#39;$organizationName&#39;&quot;</span>);
<a name="l00401"></a>00401       $row = mysql_fetch_assoc(<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>);
<a name="l00402"></a>00402       <span class="keywordflow">if</span> (!<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>) {
<a name="l00403"></a>00403          mysql_close();
<a name="l00404"></a>00404          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00405"></a>00405       } <span class="keywordflow">else</span> {
<a name="l00406"></a>00406          <span class="keywordflow">return</span> $row[<span class="stringliteral">&#39;organizationID&#39;</span>];
<a name="l00407"></a>00407       }
<a name="l00408"></a>00408    }
<a name="l00409"></a>00409 
<a name="l00417"></a><a class="code" href="classdb_organization.html#a7536d737c862712ea5199aefeb5c01f8">00417</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a7536d737c862712ea5199aefeb5c01f8">getOrganization</a>($organizationName) {
<a name="l00418"></a>00418       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00419"></a>00419       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<span class="stringliteral">&quot;SELECT * FROM organization WHERE</span>
<a name="l00420"></a>00420 <span class="stringliteral">                organizationName=&#39;$organizationName&#39;&quot;</span>);
<a name="l00421"></a>00421       mysql_close();
<a name="l00422"></a>00422       <span class="keywordflow">if</span> (!<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>) {
<a name="l00423"></a>00423          <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">//organizaationID does not exist</span>
<a name="l00424"></a>00424       } <span class="keywordflow">else</span> {
<a name="l00425"></a>00425          $row = mysql_fetch_assoc(<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>);
<a name="l00426"></a>00426          $o = <span class="keyword">new</span> <a class="code" href="class_organization.html">Organization</a>($row[<span class="stringliteral">&#39;organizationName&#39;</span>], $row[<span class="stringliteral">&#39;description&#39;</span>],
<a name="l00427"></a>00427                          $row[<span class="stringliteral">&#39;address&#39;</span>], $row[<span class="stringliteral">&#39;address1&#39;</span>], $row[<span class="stringliteral">&#39;city&#39;</span>],
<a name="l00428"></a>00428                          $row[<span class="stringliteral">&#39;stateName&#39;</span>], $row[<span class="stringliteral">&#39;zip&#39;</span>]);
<a name="l00429"></a>00429          <span class="keywordflow">return</span> $o;
<a name="l00430"></a>00430       }
<a name="l00431"></a>00431    }
<a name="l00432"></a>00432 
<a name="l00438"></a><a class="code" href="classdb_organization.html#afcd7e5c898e79a758c4bdbb67d01d5e6">00438</a>    <span class="keyword">function</span> <a class="code" href="classdb_organization.html#afcd7e5c898e79a758c4bdbb67d01d5e6">deleteOrganization</a>($o) {
<a name="l00439"></a>00439       <span class="keywordflow">if</span> (!$o instanceof organization) {
<a name="l00440"></a>00440          echo (<span class="stringliteral">&quot;Invalid arugument deleteFrom() function&lt;br /&gt;&quot;</span>);
<a name="l00441"></a>00441          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00442"></a>00442       }
<a name="l00443"></a>00443       <span class="comment">//Compose the DELETE FROM query string.</span>
<a name="l00444"></a>00444       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = sprintf(<span class="stringliteral">&quot;DELETE FROM organization WHERE organizationID = %d&quot;</span>, $o-&gt;getOpportunityID()
<a name="l00445"></a>00445       );
<a name="l00446"></a>00446       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00447"></a>00447       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00448"></a>00448       mysql_close();
<a name="l00449"></a>00449       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00450"></a>00450          echo mysql_error();
<a name="l00451"></a>00451          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00452"></a>00452       }
<a name="l00453"></a>00453 
<a name="l00454"></a>00454       <span class="comment">//Query was successful.</span>
<a name="l00455"></a>00455       <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00456"></a>00456    }
<a name="l00457"></a>00457 
<a name="l00458"></a><a class="code" href="classdb_organization.html#a51006fa276e54bc0f48e55f4e6b0b123">00458</a>    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a51006fa276e54bc0f48e55f4e6b0b123">getAllName</a>() {
<a name="l00459"></a>00459       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = <span class="stringliteral">&quot;SELECT organizationID, organizationName FROM organization ORDER BY organizationName ASC&quot;</span>;
<a name="l00460"></a>00460       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00461"></a>00461       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00462"></a>00462       mysql_close();
<a name="l00463"></a>00463 
<a name="l00464"></a>00464       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00465"></a>00465          $output = sprintf(<span class="stringliteral">&quot;%s&quot;</span>, mysql_error());
<a name="l00466"></a>00466          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00467"></a>00467       } <span class="keywordflow">else</span> {
<a name="l00468"></a>00468          <span class="keywordflow">return</span> <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>;
<a name="l00469"></a>00469       }
<a name="l00470"></a>00470    }
<a name="l00471"></a>00471 
<a name="l00472"></a><a class="code" href="classdb_organization.html#a2dfd5427fef776258f77a33a83c72411">00472</a>    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">function</span> <a class="code" href="classdb_organization.html#a2dfd5427fef776258f77a33a83c72411">getAllByID</a>($id, &amp;$output = null) {
<a name="l00473"></a>00473       <a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a> = sprintf(<span class="stringliteral">&quot;SELECT organizationName, description, address,</span>
<a name="l00474"></a>00474 <span class="stringliteral">            address1, city, stateName, zip FROM organization WHERE</span>
<a name="l00475"></a>00475 <span class="stringliteral">            organizationID=%d&quot;</span>, $id);
<a name="l00476"></a>00476       <span class="comment">//printf(&quot;-&gt;Query: %s&lt;br /&gt;&quot;, $query);</span>
<a name="l00477"></a>00477       <a class="code" href="db-control_2inc_2functions_8php.html#aca07cf60afd49a5a5b583459f5423045">connectToDatabase</a>();
<a name="l00478"></a>00478       <a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> = mysql_query(<a class="code" href="internship__list__dateadded_8php.html#af59a5f7cd609e592c41dc3643efd3c98">$query</a>);
<a name="l00479"></a>00479       mysql_close();
<a name="l00480"></a>00480 
<a name="l00481"></a>00481       <span class="keywordflow">if</span> (<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a> == <span class="keyword">false</span>) {
<a name="l00482"></a>00482          $output = sprintf(<span class="stringliteral">&quot;%s&quot;</span>, mysql_error());
<a name="l00483"></a>00483          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00484"></a>00484       }
<a name="l00485"></a>00485       <span class="comment">//process result and print out warning or attribute values</span>
<a name="l00486"></a>00486       <span class="keywordflow">return</span> dbOrganization::checkForOneInstance(<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>, $id, $output);
<a name="l00487"></a>00487    }
<a name="l00488"></a>00488 
<a name="l00489"></a>00489    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">function</span> checkForOneInstance(<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>, $id, &amp;$output) {
<a name="l00490"></a>00490       <span class="comment">//Local variables are initialized.</span>
<a name="l00491"></a>00491       $errorStatus = <span class="keyword">false</span>;
<a name="l00492"></a>00492 
<a name="l00493"></a>00493       $howMany = mysql_num_rows(<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>);
<a name="l00494"></a>00494       <span class="comment">//printf(&quot;-&gt;Found %d instance(s) for organizationID=%d.&lt;br /&gt;&quot;, $howMany, $id);</span>
<a name="l00495"></a>00495       <span class="keywordflow">switch</span> ($howMany) {
<a name="l00496"></a>00496          <span class="keywordflow">case</span> 0:
<a name="l00497"></a>00497             $output = sprintf(<span class="stringliteral">&quot;No Organization instance with ID=%d was found.&quot;</span>, $id);
<a name="l00498"></a>00498             $errorStatus = <span class="keyword">true</span>;
<a name="l00499"></a>00499             <span class="keywordflow">break</span>;
<a name="l00500"></a>00500          <span class="keywordflow">case</span> 1:
<a name="l00501"></a>00501             <span class="comment">//mysql_fetch() DOES NOT return primary key values</span>
<a name="l00502"></a>00502             $output = mysql_fetch_assoc(<a class="code" href="admin_2internship__list_8php.html#a112ef069ddc0454086e3d1e6d8d55d07">$result</a>);
<a name="l00503"></a>00503             $errorStatus = <span class="keyword">false</span>;
<a name="l00504"></a>00504             <span class="keywordflow">break</span>;
<a name="l00505"></a>00505          <span class="keywordflow">default</span>:
<a name="l00506"></a>00506             $output = sprintf(<span class="stringliteral">&quot;There are multiple Organization instances with</span>
<a name="l00507"></a>00507 <span class="stringliteral">                                  ID=%d.&quot;</span>, $id);
<a name="l00508"></a>00508             $errorStatus = <span class="keyword">true</span>;
<a name="l00509"></a>00509             <span class="keywordflow">break</span>;
<a name="l00510"></a>00510       }
<a name="l00511"></a>00511       <span class="keywordflow">return</span> $errorStatus;
<a name="l00512"></a>00512    }
<a name="l00513"></a>00513 
<a name="l00514"></a>00514 }
<a name="l00515"></a>00515 
<a name="l00516"></a>00516 ?&gt;
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Tue Nov 29 2011 18:18:54 for i2c by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
